package com.ali.aliwebsite.controller;

import com.ali.aliwebsite.entity.SwiptText;
import com.ali.aliwebsite.mapper.SwipeTextMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SwipeTextController {
    @Autowired
    SwipeTextMapper swipeTextMapper;

    @RequestMapping("swipetext/list")
    public List<SwiptText> selectAll() {
        List<SwiptText> swiptTextList = swipeTextMapper.selectAll();
        return swiptTextList;
    }

    @RequestMapping("admin/swipetext/list")
    public List<SwiptText> selectAdminAll() {
        List<SwiptText> swiptTextList = swipeTextMapper.selectAll();
        return swiptTextList;
    }

    @RequestMapping("admin/news/updateText1")
    public String updateText1(@RequestParam String text1, @RequestParam int id) {
        swipeTextMapper.updateText1(text1, id);
        return "success";
    }

    @RequestMapping("admin/news/updateText2")
    public String updateText2(@RequestParam String text2, @RequestParam int id) {
        swipeTextMapper.updateText2(text2, id);
        return "success";
    }
}
